<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>师资力量</title>
    <link th:href="@{/img/Bandit.ico}" rel="icon">
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet">
    <link th:href="@{/css/public.css}" rel="stylesheet">
    <link th:href="@{/css/teachers.css}" rel="stylesheet">
</head>
<div th:replace="~{commons/common::MyHeader}"></div>
<body>
<div class="layui-main">
    <div class="layui-card">
        <div class="layui-card-header">
            <p>老师列表</p>
        </div>
        <div class="layui-card-body teacher-show">
            <div class="teacher" th:each="teacher:${teacherList}" th:onclick="toDetails([[${teacher.tid}]])">
                <div class="teacher-img">
                    <img style="width: 200px; object-fit: contain" th:src="${teacher.teacherImg}" >
                </div>
                <div class="teacher-info">
                    <strong>姓名：</strong><span th:text="${teacher.tName}"></span>
                    <br>
                    <strong>职位：</strong><span th:each="role:${roleList}" th:text="${role.roleName}" th:if="${role.rid eq teacher.roleID}"></span>
                </div>
            </div>
        </div>
    </div>
</div>

<script th:inline="javascript">
    var roleList = [[${roleList}]];
</script>
<div th:replace="~{commons/common::pubScript}"></div>
<script>
    function toDetails(tid){
        window.location.href="/front/teachers/toDetails/"+tid;
    }
</script>
</body>
</html>